<template>
    <view class="smart-page">
        <view class="smart-page-head">
            <view class="smart-page-head-title">video</view>
        </view>
        <view>
            <video id="myVideo" src="../../../static/video/shipin.mp4"
            danmu-btn="true" enbale-danmu="true" :danmu-list="video_danmu_list"></video>
        </view>
        <view class="input_box">
            <input placeholder="评论内容" v-model="inputValue"/>
        </view>
        <view calss="btn_box">
            <button type="primary" @click="sendMsg">发送弹幕</button>
        </view>
    </view>
</template>

<script>
export default{
    data(){
        return{
            inputValue:'',
            videoContext:'',
            video_danmu_list:[{
                text:"你好",
                tuime:1,
                color:'green'
            },
            {
                text:'hello',
                time:2,
                color:'brown'
            },
            {
                text:'Ok',
                time:3,
                color:'orange'
            }
            ]
        }
    },
    onReady(){
        this.videoContext = uni.createVideoContext('myVideo');
    },
    methods:{
        sendMsg(){
            console.log(this.inputValue);
            this.videoCContext.sendDanmu({
                text:this.inputValue,
                color:'red'
            })
        }
    }
}
</script>